package com.activity.fragment;

import android.Manifest;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.activity.App;
import com.activity.FaceDetectExpActivity;
import com.activity.FaceLivenessExpActivity;
import com.activity.JiaBanActivity;
import com.activity.WebActivity;
import com.activity.adapter.ClockAdapter;
import com.activity.bean.CheckBean;
import com.activity.bean.ClassBean;
import com.activity.bean.UserBean;
import com.activity.shop.AttanceGroupActivity;
import com.amap.api.location.CoordinateConverter;
import com.amap.api.location.DPoint;
import com.api.param.GroupParam;
import com.api.param.SignParam;
import com.api.param.UserParam;
import com.api.response.TodayResponse;
import com.api.viewModel.StoreVM;
import com.example.apple.ddhr_new.R;
import com.example.apple.ddhr_new.utils.ActivityUtil;
import com.example.apple.ddhr_new.utils.BaiDuUtil;
import com.example.apple.ddhr_new.utils.ImageViewUtil;
import com.example.apple.ddhr_new.utils.ScreenUtil;
import com.example.apple.ddhr_new.utils.StringUtil;
import com.example.lzbase.BaseViewModelFragment;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;

import org.apache.commons.lang3.StringUtils;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import androidx.annotation.NonNull;
import butterknife.BindView;
import butterknife.OnClick;
import event.MessageEvent;

import static com.example.apple.ddhr_new.activity.setting.WebViewActivity.INTENT_TITLE;
import static com.example.apple.ddhr_new.activity.setting.WebViewActivity.INTENT_URL;
import static event.MessageEvent.MESSAGE_EVENT_FACE_SUCCESS;

public class ClockFragment extends BaseViewModelFragment<StoreVM> {

    @BindView(R.id.tv_end_time)
    TextView tvEndTime;
    @BindView(R.id.clock_time)
    TextView clockTime;
    @BindView(R.id.tv_address)
    TextView tvAddress;
    private double mlat;
    private double mlng;
    private String maddress = "";
    ClockAdapter clockAdapter;
    @BindView(R.id.tv_name)
    ImageView tvName;
    @BindView(R.id.tv_my_name)
    TextView tvMyName;
    @BindView(R.id.tv_group_name)
    TextView tvGroupName;
    @BindView(R.id.tv_group_name_text)
    TextView tv_group_name_text;

    @BindView(R.id.l_class)
    LinearLayout lclass;
    @BindView(R.id.tv_date)
    TextView tvDate;
    @BindView(R.id.l_bottom)
    LinearLayout lBottom;
    @BindView(R.id.refreshLayout)
    SmartRefreshLayout refreshLayout;
    @BindView(R.id.l_content)
    LinearLayout l_content;
    @BindView(R.id.r_name)
    RelativeLayout rName;
    @BindView(R.id.l_group)
    LinearLayout lGroup;
    @BindView(R.id.line_start)
    View lineStart;
    @BindView(R.id.line_end)
    View line_end;
    @BindView(R.id.tv_que_ka)
    TextView tvQueKa;
    @BindView(R.id.clock_time_start)
    TextView clockTimeStart;
    @BindView(R.id.tv_address_start)
    TextView tvAddressStart;
    @BindView(R.id.r_end)
    RelativeLayout rEnd;
    @BindView(R.id.l_address)
    LinearLayout lAddress;
    @BindView(R.id.r_daka)
    RelativeLayout rDaka;
    @BindView(R.id.tv_time)
    TextView tvTime;
    @BindView(R.id.tv_daka_name)
    TextView tvDakaName;
    @BindView(R.id.tv_daka_time)
    TextView tvDakaTime;
    @BindView(R.id.tv_location_address)
    TextView tvLocationAddress;
    @BindView(R.id.tv_location_send)
    TextView tvLocationSend;
    private ClassBean currentClass;
    @BindView(R.id.tv_class)
    TextView tv_class;

    private TodayResponse today;

    private SignParam signParam;
    private boolean isFill = false;
    private String ifok = "0";
    private boolean isWaichu;
    private String category="";

    @Override
    public int getLayoutId() {
        return R.layout.layout_fragment_clock;
    }

    @Override
    public void createView() {
        super.createView();

        clockAdapter = new ClockAdapter(mContext);


        clockAdapter.clockListener = new ClockAdapter.ClockListener() {
            @Override
            public void attanceGroupClick() {
                if (App.getInstance().getAccount().getAttendancegroupinfo() != null && App.getInstance().getAccount().getAttendancegroupinfo().size() > 0) {

                    ActivityUtil.startActivity(mContext, AttanceGroupActivity.class);

                }
            }
        };


        viewModel.attanceGroupInfo.observe(this, res -> {

            currentClass = res.get(0);

            addSubscription(viewModel.getTodayCheck(new UserParam()));


        });
        viewModel.todayCheck.observe(this, res -> {
            if (res != null) {
                today = res;

                resetData();
            } else {

            }


            refreshLayout.finishRefresh();
        });
        if (App.getInstance().getAccount().getAttendancegroupinfo() != null && App.getInstance().getAccount().getAttendancegroupinfo().size() > 0) {
            GroupParam param = new GroupParam();
            param.attendancegroupid = App.getInstance().getAccount().getAttendancegroupinfo().get(0).getAttendancegroupid();
            addSubscription(viewModel.getGroupInfo(param));

        }


        refreshLayout.setEnableLoadMore(false);
        resetData();

        refreshLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(@NonNull RefreshLayout refreshLayout) {

                addSubscription(viewModel.getTodayCheck(new UserParam()));
            }
        });

        viewModel.sign.observe(this, res -> {
            refreshLayout.autoRefresh();
        });
        viewModel.sign2.observe(this, res -> {
            refreshLayout.autoRefresh();
        });
        getLocation();

    }

    public void resetData() {
        ImageView name = tvName;
        TextView myName = tvMyName;
        TextView groupName = tv_group_name_text;
        TextView date = tvDate;
        lclass.removeAllViews();

        if (App.getInstance().getAccount().getAttendancegroupinfo() != null && App.getInstance().getAccount().getAttendancegroupinfo().size() > 0) {

            UserBean.AttendancegroupinfoBean bean = App.getInstance().getAccount().getAttendancegroupinfo().get(0);
            groupName.setText(bean.getAttendancegroupname());
            ImageViewUtil.loadCircleImage(App.getInstance().getAccount().getUsericon(), name, mContext);
//            name.setText(App.getInstance().getAccount().getUsernickname());
            myName.setText(App.getInstance().getAccount().getUsernickname());


            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

            String dateString = dateFormat.format(new Date());
            date.setText(dateString);
            l_content.setVisibility(View.VISIBLE);
            refreshLayout.setEnableRefresh(true);

        } else {

            l_content.setVisibility(View.GONE);
            refreshLayout.setEnableRefresh(false);
        }

        if (currentClass == null) {

            lBottom.setVisibility(View.GONE);

        } else {
            lBottom.setVisibility(View.VISIBLE);

            int day = StringUtil.getDayOfWeek();
            ClassBean.AttendancetimespanBean span = currentClass.getClassForDay(day);
            tv_class.setText(currentClass.getClassSpan());
            if (span == null) {
                lAddress.setVisibility(View.GONE);
                rEnd.setVisibility(View.GONE);
//                rDaka.setVisibility(View.GONE);
                tvQueKa.setVisibility(View.GONE);
                lineStart.setVisibility(View.GONE);
                clockTimeStart.setVisibility(View.GONE);
                tvAddressStart.setVisibility(View.GONE);

                tvTime.setText("今日休息");
            } else {

                if (today.getStart() == null) {

                    if (today.getEnd() == null) {

                        SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");

                        String dateString = dateFormat.format(new Date());

                        ArrayList<String> dateArray = new ArrayList(Arrays.asList(StringUtils.split(dateString, ":")));
                        int dateH = StringUtil.getMinute(dateArray);
                        int bdateH = StringUtil.getMinute(new ArrayList(Arrays.asList(StringUtils.split(span.getAttendacetimespan_begintime(), ":"))));
                        int edateH = StringUtil.getMinute(new ArrayList(Arrays.asList(StringUtils.split(span.getAttendacetimespan_endtime(), ":"))));
//                        rDaka.setVisibility(View.VISIBLE);
                        lAddress.setVisibility(View.VISIBLE);
                        clockTimeStart.setVisibility(View.GONE);
                        tvAddressStart.setVisibility(View.INVISIBLE);
                        if ((Math.abs(dateH - bdateH)) < (Math.abs(edateH - dateH))) {
                            lineStart.setVisibility(View.GONE);
                            rEnd.setVisibility(View.GONE);
                            tvQueKa.setVisibility(View.GONE);
                            tvTime.setText("上班时间" + " " + span.getAttendacetimespan_begintime());
                            tvDakaName.setText("上班打卡");
                            SimpleDateFormat dateFormat1 = new SimpleDateFormat("HH:mm:ss");

                            String dateString1 = dateFormat1.format(new Date());
                            tvDakaTime.setText(dateString1);

                            getLocation();


                        } else {
                            tvQueKa.setVisibility(View.VISIBLE);
                            lineStart.setVisibility(View.VISIBLE);
                            rEnd.setVisibility(View.VISIBLE);
                            clockTime.setVisibility(View.GONE);
                            tvAddress.setVisibility(View.GONE);
                            tvEndTime.setText("下班时间" + " " + span.getAttendacetimespan_endtime());

                            tvDakaName.setText("下班打卡");
                            SimpleDateFormat dateFormat1 = new SimpleDateFormat("HH:mm:ss");

                            String dateString1 = dateFormat1.format(new Date());
                            tvDakaTime.setText(dateString1);

                            getLocation();

                        }

                    } else {


//                        rDaka.setVisibility(View.VISIBLE);
                        lAddress.setVisibility(View.VISIBLE);
                        clockTimeStart.setVisibility(View.GONE);
                        tvAddressStart.setVisibility(View.INVISIBLE);

                        tvQueKa.setVisibility(View.VISIBLE);
                        lineStart.setVisibility(View.VISIBLE);
                        rEnd.setVisibility(View.VISIBLE);
                        clockTime.setVisibility(View.VISIBLE);
                        tvAddress.setVisibility(View.VISIBLE);
                        clockTime.setText("打卡时间" + " " + today.getEnd().getCheckinrecordactualtime());
                        tvAddress.setText(today.getEnd().getCheckinrecordlocation());
                        Drawable mTipsIcon = null;
                        if (today.getEnd().getCheckinrecordstatus().equals("-1")) {
                            mTipsIcon = getResources().getDrawable(R.drawable.yichangdaka);
                        } else {
                            mTipsIcon = getResources().getDrawable(R.drawable.icon_anotation);
                        }


                        mTipsIcon.setBounds(0, 0, (int) (mTipsIcon.getMinimumWidth()),
                                (int) (mTipsIcon.getMinimumHeight()));
                        tvAddress.setCompoundDrawablePadding(ScreenUtil.dp2px(mContext, 5));

                        tvAddress.setCompoundDrawables(mTipsIcon, null, null, null);

                        tvEndTime.setText("下班时间" + " " + span.getAttendacetimespan_endtime());
                        tvDakaName.setText("下班打卡");
                        SimpleDateFormat dateFormat1 = new SimpleDateFormat("HH:mm:ss");

                        String dateString1 = dateFormat1.format(new Date());
                        tvDakaTime.setText(dateString1);
                        getLocation();

                    }


                } else {

                    clockTimeStart.setVisibility(View.VISIBLE);
                    lineStart.setVisibility(View.VISIBLE);
                    tvAddressStart.setVisibility(View.VISIBLE);
                    tvQueKa.setVisibility(View.GONE);
                    tvTime.setText("上班时间" + " " + span.getAttendacetimespan_begintime());
                    clockTimeStart.setText("打卡时间" + " " + today.getStart().getCheckinrecordactualtime());
                    tvAddressStart.setText(today.getStart().getCheckinrecordlocation());


                    Drawable mTipsIcon = null;
                    if (today.getStart().getCheckinrecordstatus().equals("-1")) {
                        mTipsIcon = getResources().getDrawable(R.drawable.yichangdaka);
                    } else {
                        mTipsIcon = getResources().getDrawable(R.drawable.icon_anotation);
                    }


                    mTipsIcon.setBounds(0, 0, (int) (mTipsIcon.getMinimumWidth()),
                            (int) (mTipsIcon.getMinimumHeight()));
                    tvAddressStart.setCompoundDrawablePadding(ScreenUtil.dp2px(mContext, 5));

                    tvAddressStart.setCompoundDrawables(mTipsIcon, null, null, null);

                    rEnd.setVisibility(View.VISIBLE);
                    tvEndTime.setText("下班时间" + " " + span.getAttendacetimespan_endtime());

                    if (today.getEnd() == null) {

//                        rDaka.setVisibility(View.VISIBLE);
                        lAddress.setVisibility(View.VISIBLE);


                        clockTime.setVisibility(View.GONE);
                        tvAddress.setVisibility(View.GONE);

                        tvDakaName.setText("下班打卡");
                        SimpleDateFormat dateFormat1 = new SimpleDateFormat("HH:mm:ss");

                        String dateString1 = dateFormat1.format(new Date());
                        tvDakaTime.setText(dateString1);


                        getLocation();


                    } else {


//                        rDaka.setVisibility(View.VISIBLE);
                        lAddress.setVisibility(View.VISIBLE);


                        clockTime.setVisibility(View.VISIBLE);
                        tvAddress.setVisibility(View.VISIBLE);
                        clockTime.setText(today.getEnd().getCheckinrecordactualtime());
                        Drawable mTipsIcon1 = null;
                        if (today.getEnd().getCheckinrecordstatus().equals("-1")) {
                            mTipsIcon1 = getResources().getDrawable(R.drawable.yichangdaka);


                        } else {
                            mTipsIcon1 = getResources().getDrawable(R.drawable.icon_anotation);

                        }
                        mTipsIcon1.setBounds(0, 0, (int) (mTipsIcon1.getMinimumWidth()),
                                (int) (mTipsIcon1.getMinimumHeight()));
                        tvAddress.setCompoundDrawablePadding(ScreenUtil.dp2px(mContext, 5));

                        tvAddress.setCompoundDrawables(mTipsIcon1, null, null, null);

                        tvAddress.setText(today.getEnd().getCheckinrecordlocation());

                        tvDakaName.setText("下班打卡");
                        SimpleDateFormat dateFormat1 = new SimpleDateFormat("HH:mm:ss");

                        String dateString1 = dateFormat1.format(new Date());
                        tvDakaTime.setText(dateString1);

                    }


                }

            }


            if (today.getOverTimeCheck().size() > 0) {

                for (int i = 0; i < today.getOverTimeCheck().size(); i++) {

                    CheckBean checkBean = today.getOverTimeCheck().get(i);
                    View view = View.inflate(mContext, R.layout.layout_jiaban, null);
                    View dot_bottom = view.findViewById(R.id.dot_bottom);
                    TextView tvEndTime = view.findViewById(R.id.tv_end_time);
                    TextView clockTime = view.findViewById(R.id.clock_time);
                    TextView tvAddress = view.findViewById(R.id.tv_address);
                    View line_start = view.findViewById(R.id.line_start);

                    if(checkBean.getCheckinrecordkind().equals("1")){
                        clockTime.setText("打卡时间" + " " + checkBean.getCheckinrecordactualtime());
                        tvEndTime.setText("下班时间" + " " + span.getAttendacetimespan_endtime());
                    }else {
                        if(checkBean.getCheckinrecordcategory().equals("1")){
                            clockTime.setText("外出时间" + " " + checkBean.getCheckinrecordactualtime());
                            tvEndTime.setText("下班时间" + " " + span.getAttendacetimespan_endtime());
                        }else {
                            clockTime.setText("外出结束时间" + " " + checkBean.getCheckinrecordactualtime());
                            tvEndTime.setText("下班时间" + " " + span.getAttendacetimespan_endtime());
                        }
                    }

                    tvAddress.setText(checkBean.getCheckinrecordlocation());
                    Drawable mTipsIcon = null;
                    if (checkBean.getCheckinrecordstatus().equals("-1")) {
                        mTipsIcon = getResources().getDrawable(R.drawable.yichangdaka);
                    } else {
                        mTipsIcon = getResources().getDrawable(R.drawable.icon_anotation);
                    }


                    mTipsIcon.setBounds(0, 0, (int) (mTipsIcon.getMinimumWidth()),
                            (int) (mTipsIcon.getMinimumHeight()));
                    tvAddress.setCompoundDrawablePadding(ScreenUtil.dp2px(mContext, 5));

                    tvAddress.setCompoundDrawables(mTipsIcon, null, null, null);
                    if (today.getOverTimeCheck().size() == (i + 1)) {
                        line_start.setVisibility(View.GONE);
                    } else {


                    }
                    lclass.addView(view);
                }
                line_end.setVisibility(View.VISIBLE);

            } else {
                line_end.setVisibility(View.GONE);
            }


        }
    }

    private void getLocation() {

        checkLocation(new LocationPermissionListener() {
            @Override
            public void hasLocationPermission() {


                com.example.apple.ddhr_new.App.self().baiDuUtil.start(new BaiDuUtil.LocationResult() {
                    @Override
                    public void callBack(boolean success, double lat, double lng, String address) {
                        mlat = lat;
                        mlng = lng;
                        maddress = address;
                        setAddress();
                    }
                });


            }
        });
    }

    @OnClick(R.id.l_group)
    public void onViewClicked() {
        ActivityUtil.startActivity(mContext, AttanceGroupActivity.class);

    }

    @OnClick(R.id.tv_location_send)
    public void location_Clicked() {
        getLocation();

    }

    public void setAddress() {

        if (currentClass.getAttendanceregionlist().size() == 0) {
            tvLocationAddress.setText(maddress);

            ifok = "0";
            tvLocationAddress.setCompoundDrawables(null, null, null, null);
        } else {

            int radius = Integer.valueOf(currentClass.getAttendancegroupradius());

            boolean isRadius = false;
            ClassBean.AttendanceregionlistBean attendanceregionlistBean = null;
            for (int i = 0; i < currentClass.getAttendanceregionlist().size(); i++) {
                ClassBean.AttendanceregionlistBean bean = currentClass.getAttendanceregionlist().get(i);
                float distance = CoordinateConverter.calculateLineDistance(new DPoint(mlat, mlng), new DPoint(Double.valueOf(bean.getAttendanceregionlat()), Double.valueOf(bean.getAttendanceregionlng())));
                if (distance > radius) {


                } else {
                    isRadius = true;
                    attendanceregionlistBean = bean;
                    break;
                }


            }
            if (isRadius) {
                tvLocationAddress.setText("已进入考勤范围" + attendanceregionlistBean.getAttendanceregionaddress());

                ifok = "1";

                Drawable rightDrawable = getResources().getDrawable(R.drawable.icon_check);
                rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight());
                tvLocationAddress.setCompoundDrawables(rightDrawable, null, null, null);

            } else {
                tvLocationAddress.setText(maddress + "(不在考勤范围)");
                ifok = "0";
                tvLocationAddress.setCompoundDrawables(null, null, null, null);
            }
        }
    }

    @OnClick(R.id.r_daka)
    public void signClicked() {

        isFill = false;
        getLocation();
        if (hasPermission(Manifest.permission.CAMERA)) {

            if ("1".equals(App.getInstance().getAccount().getUserfacecertificated())) {

                ActivityUtil.startActivity(mContext, FaceDetectExpActivity.class);
            } else {


                ActivityUtil.startActivity(mContext, FaceLivenessExpActivity.class);


            }

//                    ActivityUtil.startActivity(LoginActivity.this,FaceDetectExpActivity.class);

        } else {
            requestPersion(Manifest.permission.CAMERA, "请打开摄像头权限", 1000);
        }


    }

    @Override
    public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {
        super.onPermissionsGranted(requestCode, perms);

        if (requestCode == 1000) {
            if ("1".equals(App.getInstance().getAccount().getUserfacecertificated())) {

                ActivityUtil.startActivity(mContext, FaceDetectExpActivity.class);
            } else {


                ActivityUtil.startActivity(mContext, FaceLivenessExpActivity.class);


            }
        }
    }

    @Override
    public void onMessageEventBus(MessageEvent event) {
        super.onMessageEventBus(event);
        if (event.getMessage() == MESSAGE_EVENT_FACE_SUCCESS) {


            signParam = new SignParam();
            signParam.attendancegroupno = currentClass.getAttendancegroupno();
            if (today.getStart() == null && today.getEnd() == null) {
                signParam.checkinno = StringUtil.radom3String();

            } else {
                if (today.getStart() == null) {
                    signParam.checkinno = today.getEnd().getCheckinrecordcheckinno();
                } else {
                    signParam.checkinno = today.getStart().getCheckinrecordcheckinno();
                }
            }
            signParam.attendacetimespanid = currentClass.getAttendancegroup_attendancetimespanid();
            signParam.lat = mlat + "";
            signParam.lng = mlng + "";
            signParam.location = maddress;
            signParam.ifok = ifok;
            signParam.storeno = App.getInstance().userstoreinfoBean.getStoreno();
            if (isFill) {
                signParam.category = "1";
            } else {
                if (tvDakaName.getText().toString().equals("下班打卡")) {

                    signParam.category = "2";
                } else {
                    signParam.category = "1";

                }
            }

            signParam.kind=(isWaichu?"2":"1");

            if(isWaichu){

                if(today.getWaichuTimes()%2==0){
                    signParam.category = "1";
                }else {
                    signParam.category = "2";
                }
            }else {
                if (tvDakaName.getText().toString().equals("下班打卡")) {

                    signParam.category = "2";
                } else {
                    signParam.category = "1";

                }
            }

            if(isWaichu){
                signParam.items=category;
                addSubscription(viewModel.checkin2(signParam));
            }else {
                addSubscription(viewModel.sign(signParam));
            }

        }
    }

    @OnClick(R.id.tv_que_ka)
    public void fillClicked() {
        isFill = true;
        if (hasPermission(Manifest.permission.CAMERA)) {
            if ("1".equals(App.getInstance().getAccount().getUserfacecertificated())) {

                ActivityUtil.startActivity(mContext, FaceDetectExpActivity.class);
            } else {


                ActivityUtil.startActivity(mContext, FaceLivenessExpActivity.class);


            }


//                    ActivityUtil.startActivity(LoginActivity.this,FaceDetectExpActivity.class);

        } else {
            requestPersion(Manifest.permission.CAMERA, "请打开摄像头权限", 1000);
        }


    }
    @OnClick({R.id.l_jiaban})
    public void jiabanClicked(View view) {
        Bundle param = new Bundle();
        ActivityUtil.startActivity(this, JiaBanActivity.class,param,1001);

    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(requestCode==1001&&resultCode==1001){
           category = data.getStringExtra("data");
           isWaichu = true;
            isFill = false;
            getLocation();
        if (hasPermission(Manifest.permission.CAMERA)) {

            if ("1".equals(App.getInstance().getAccount().getUserfacecertificated())) {

                ActivityUtil.startActivity(mContext, FaceDetectExpActivity.class);
            } else {


                ActivityUtil.startActivity(mContext, FaceLivenessExpActivity.class);


            }

//                    ActivityUtil.startActivity(LoginActivity.this,FaceDetectExpActivity.class);

        } else {
            requestPersion(Manifest.permission.CAMERA, "请打开摄像头权限", 1000);
        }
        }
    }

    @OnClick({R.id.l_face,R.id.l_waichu})
    public void faceClicked(View view) {

        isWaichu = (view.getId()==R.id.l_waichu);
        isFill = false;
        getLocation();
        if (hasPermission(Manifest.permission.CAMERA)) {

            if ("1".equals(App.getInstance().getAccount().getUserfacecertificated())) {

                ActivityUtil.startActivity(mContext, FaceDetectExpActivity.class);
            } else {


                ActivityUtil.startActivity(mContext, FaceLivenessExpActivity.class);


            }

//                    ActivityUtil.startActivity(LoginActivity.this,FaceDetectExpActivity.class);

        } else {
            requestPersion(Manifest.permission.CAMERA, "请打开摄像头权限", 1000);
        }

//        Bundle param = new Bundle();
//        param.putString(INTENT_TITLE,"外出报表");
//
//        String url = "http://106.15.46.6:8086/outreport?storeno="+ App.getInstance().userstoreinfoBean.getStoreno();
//
//        param.putString(INTENT_URL,url);
//        ActivityUtil.startActivity(mContext, WebActivity.class,param);
//
//        return;

    }

}
